get a taste of (one's) own medicine

Translations
испытать на себе то, что причинял другим
After years of being rude to others, he finally got a taste of his own medicine.
После многих лет грубости к другим он наконец испытал на себе то, что причинял другим.
Definitions
To experience the same unpleasant or harmful treatment that one has given to others, often as a form of poetic justice or retribution.